
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="jdk.nashorn.internal.runtime.Undefined" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/bootstrap.min.css">

    <title>添加数据</title>


</head>
<body>
<div>


    <div class="form-group">
        <label for="id">id</label>
        <input type="text" class="form-control" name="id" id="id" value="">
    </div>
    <div class="form-group">
        <label for="userName">姓名</label>
        <input type="text" class="form-control" name="userName" id="userName" value="">
    </div>
    <div class="form-group">
        <label for="sex">性别</label>
        <input type="text" class="form-control" name="sex" id="sex" value="">
    </div>
    <div class="form-group">
        <label for="age">年龄</label>
        <input type="text" class="form-control" name="age" id="age" value="">
    </div>
    <div class="form-group">
        <label for="addr">籍贯</label>
        <input type="text" class="form-control" name="addr" id="addr" value="">
    </div>
    <div class="form-group">
        <label for="qq">QQ</label>
        <input type="text" class="form-control" name="qq" id="qq" value="">
    </div>
    <div class="form-group">
        <label for="email">邮箱</label>
        <input type="text" class="form-control" name="email" id="email" value="">
    </div>

    <button type="button" onclick="addDD()" class="btn btn-default">添加</button>
    <button type="button" onclick="back()" class="btn btn-default">返回</button>


</div>

</body>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js">
</script>
<script>
    function addDD() {
        var id = $("#id").val();
        var userName = $("#userName").val();
        var sex = $("#sex").val();
        var age = $("#age").val();
        var addr = $("#addr").val();
        var qq = $("#qq").val();
        var email = $("#email").val();
        $.post("addData", {
            "id": id,
            "userName": userName,
            "sex": sex,
            "age": age,
            "addr": addr,
            "qq": qq,
            "email": email
        }, function (data) {
            alert(data);
        })
    }

    function back() {
        location.href = "${pageContext.request.contextPath}/userList"
    }
</script>
</html>
